package test4;

import java.io.*;
import java.net.Socket;

public class cilent {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("zjc的电脑",9898);
        OutputStream ots = socket.getOutputStream();
        DataOutputStream dos = new DataOutputStream(ots);
        dos.writeUTF("下载图片");
        InputStream ist = socket.getInputStream();
        byte[] bytes = ist.readAllBytes();
        long l = System.currentTimeMillis();
        FileOutputStream fio = new FileOutputStream("C:\\java\\film\\" + l + ".jpeg");
        fio.write(bytes);System.out.println("下载完成");
        fio.close();
        ist.close();
        dos.close();
        ots.close();
        socket.close();


    }
}
